package co.fitstart.entity.course.schedule;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.springframework.format.annotation.DateTimeFormat;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

/**
 * 上课当天课次取消记录
 * @author haiyan_xiao
 *
 */
@Entity
@Table(name = "course_schedule_cancel_record")
@JsonIgnoreProperties(value={"hibernate_lazy_initializer","handler","fieldHandler"})
public class CourseScheduleCancelRecord {
    @Id
    @GeneratedValue
    private Long id;
    
    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    private CourseSchedule courseSchedule;
    
    /** 取消或换课 */
    @Column(name = "is_cancel")
    private boolean cancel;
    
    /** 操作日期 */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @org.hibernate.annotations.Type(type = "date")
    private Date occurDate;
    
    public CourseScheduleCancelRecord() {
        
    }
    
    public CourseScheduleCancelRecord(CourseSchedule courseSchedule, boolean cancel) {
        this.courseSchedule = courseSchedule;
        this.cancel = cancel;
        this.occurDate = courseSchedule.getOccurDate();
    }

    /**
     * @return the id
     */
    public Long getId() {
        return id;
    }

    /**
     * @param id the id to set
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * @return the courseSchedule
     */
    public CourseSchedule getCourseSchedule() {
        return courseSchedule;
    }

    /**
     * @param courseSchedule the courseSchedule to set
     */
    public void setCourseSchedule(CourseSchedule courseSchedule) {
        this.courseSchedule = courseSchedule;
    }

    /**
     * @return the cancel
     */
    public boolean isCancel() {
        return cancel;
    }

    /**
     * @param cancel the cancel to set
     */
    public void setCancel(boolean cancel) {
        this.cancel = cancel;
    }

    /**
     * @return the occurDate
     */
    public Date getOccurDate() {
        return occurDate;
    }

    /**
     * @param occurDate the occurDate to set
     */
    public void setOccurDate(Date occurDate) {
        this.occurDate = occurDate;
    }
}
